<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');


//counting variable
$i = 0;

echo "<p>";
	echo "<a href='index.php'>&lt;&lt; Back to Semesters Portal</a><br />";
echo "</p>";
echo "<h1>Add Semester</h1>";

echo "<p>";
	echo "<b>Please enter date in YYYY-MM-DD format</b>";
echo "</p>";
	


echo "<form action='add_do.php' method='post'>";

//start table
echo "<table border='0'>";
	
	//create table row
	echo "<tr>";
		echo "<td width=180><b>Session Number: </b></td>";
		echo "<td><input type='text' name='session_num'></td>";
	echo "</tr>";
	
	//create table row
	echo "<tr>";
		echo "<td><b>Year: </b></td>";
		echo "<td><input type='text' name='year'></td>";
	echo "</tr>";
	
	$result=mysql_query("SELECT * FROM seasons ORDER BY season");
	$num_rows=mysql_numrows($result);
	
	echo "<tr>";
		echo "<td><b>Season:</b></td>";
		echo "<td>";
			echo "<select name='season'>";
				while ($i < $num_rows)
				{
					$season_id=mysql_result($result,$i,"id");
					$season=mysql_result($result,$i,"season");
					echo "<option value=$season_id>$season</option>";
					$i++;
				}
			echo "</select>";
		echo '</td>';
	echo "</tr>";
	
	//create table row
	echo "<tr>";
		echo "<td><b>Start Date: </b></td>";
		echo "<td><input type='text' name='start'></td>";
	echo "</tr>";
	
	//create table row
	echo "<tr>";
		echo "<td><b>End Date: </b></td>";
		echo "<td><input type='text' name='end'></td>";
	echo "</tr>";
	
//end table tag
echo "</table>";

//close
mysql_close();

echo '<p><input type="submit"></p>';
echo '</form>';





echo '<h2>OR</h2>';

echo "<form action='add_season.php' method='post'>";

//start table
echo "<table border='0'>";

	//create table row
	echo "<tr>";
		echo "<td><b>Add Season: </b></td>";
		echo "<td><input type='text' name='new_season'></td>";
	echo "</tr>";

//end table tag
echo "</table>";
	
echo '<p><input type="submit"></p>';
echo '</form>';




?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>